<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
</head>
<body>
<p th:text="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}">time</p>


<a th:href="@{/user/add}">添加用户</a>

<table>
    <tr>
        <th>用户ID</th>
        <th>用户姓名</th>
        <th>用户年龄</th>
        <th>操作</th>
    </tr>
    <tr th:each="user : ${list.list}">
        <td th:text="${user.id}"></td>
        <td th:text="${user.username}"></td>
        <td th:text="${user.age}"></td>
        <td>
            <a th:href="@{/user/findUserById(id=${user.id})}">修改</a>|
            <a th:href="@{/user/delete(id=${user.id})}">删除</a>
        </td>
    </tr>
</table>
<!--分页控件-->
<div>
    <a th:if="${!list.isFirstPage}" th:href="@{/user/showUser?pageNum=1}">首页</a>
    <a th:disabled="${!list.hasPreviousPage}?'disabled':''"
       th:href="@{/user/showUser(pageNum=${list.hasPreviousPage?list.pageNum-1:1})}">上一页</a>
    <a th:disabled="${!list.hasNextPage}?'disabled':''"
       th:href="@{/user/showUser(pageNum=${list.hasNextPage?list.pageNum+1:list.pages})}">下一页</a>
    <a th:if="${!list.isLastPage}" th:href="@{/user/showUser(pageNum=${list.pages})}">尾页</a>
</div>

</body>